<?php

/**
 * @package Spider Contacts
 * @author Web-Dorado
 * @copyright (C) 2012 Web-Dorado. All rights reserved.
 * @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 **/


defined( '_JEXEC' ) or die( 'Restricted access' );

$document = JFactory::getDocument();



$cmpnt_css_path = JURI::root(true).'/components/com_spidercontacts/css';

$document->addStyleSheet($cmpnt_css_path.'/spidercontacts_main.css');



$cmpnt_js_path = JURI::root(true).'/components/com_spidercontacts/js';

$document->addScript($cmpnt_js_path.'/common.js');







$document->addScript('components/com_spidercontacts/spiderBox/spiderBox.js.php?delay=3000&allImagesQ=0&slideShowQ=0&darkBG=1&juriroot='.urlencode(JURI::root(false)).'&spiderShop=1');




require_once( JPATH_COMPONENT.DS.'controller.php' );
$controller = JRequest::getVar( 'controller' );

/*
if($controller = JRequest::getVar( 'controller' )) {

    require_once( JPATH_COMPONENT.DS.'controllers'.DS.$controller.'.php' );

}
*/

global $param_values;
$db = JFactory::getDBO();
$query ="SELECT *  from #__spidercontacts_params ";

$db->setQuery($query);
$rows = $db->loadObjectList();
if ($db->getErrorNum()) {
	echo $db->stderr();
	return false;
}
$param_values=array();

foreach($rows as $row){
$key=$row->name;
$value=$row->value;
$param_values[$key]=$value;
}



class jsshparams{
    
    function get($key) {
		global $param_values;	
        return $param_values[$key];
    }
}





$classname    = 'spidercontactsController'.$controller;

$controller   = new $classname( );



$controller->execute( JRequest::getVar( 'task' ) );



$controller->redirect();

?>